//
//  JXHTitleButton.swift
//  JXHSinaWeiBo
//
//  Created by juxiaohui on 16/10/18.
//  Copyright © 2016年 juxiaohui. All rights reserved.
//

import UIKit

class JXHTitleButton: UIButton {


  override  init(frame: CGRect) {
        super.init(frame: frame)
    
        setImage(UIImage.init(named: "navigationbar_arrow_down"), for: .normal)
        setImage(UIImage.init(named: "navigationbar_arrow_up"), for: .selected)
        setTitleColor(UIColor.black, for: .normal)
        sizeToFit()
    }
    
    //重写layoutSubviews
    
    override func layoutSubviews() {
        
        super.layoutSubviews()
        titleLabel!.frame.origin.x = 0
        
        imageView!.frame.origin.x = titleLabel!.frame.size.width + 5
    }
    
    
    //Swift中规定重写控件的init(frame)方法必须重写init?(coder aDecoder: NSCoder)
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
